/**
 * 
 */
package garin.parse;

import java.io.IOException;

public final class LineComment extends CommentToken {
	private final String introducer;
	
	public LineComment(final Token source, final String introducer) {
		super(source);
		this.introducer = introducer;
	}
	
	@Override
	public boolean accept() throws IOException {
		return source().is(introducer);
	}
	
	@Override
	public Token on() throws Exception {
		if (is('\n') || is('\r'))
			return up();
		else
			return self();
	}
}
